package com.chinasolf.controller;

import com.chinasoft.model.hosp.Hospital;
import com.chinasoft.vo.hosp.HospitalQueryVo;
import com.chinasolf.result.R;
import com.chinasolf.service.HospitalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api(description = "医院接口")
@RestController
@RequestMapping("/admin/hosp/hospital")
public class HospitalController {

    @Autowired
    private HospitalService hospitalService;

    //医院分页查询列表
    @ApiOperation(value = "获取分页列表")
    @GetMapping("{page}/{limit}")
    public R list(@PathVariable Integer page, @PathVariable Integer limit, HospitalQueryVo hospitalQueryVo){
        Page<Hospital> pageModel = hospitalService.selectPage(page,limit,hospitalQueryVo);
        return R.ok().data("pages",pageModel);
    }
    //医院的详情显示接口
    @ApiOperation(value = "获取医院详情")
    @GetMapping("show/{id}")
    public R show(@PathVariable String id){
        Map<String,Object> map = hospitalService.showHosp(id);
        return R.ok().data(map);
    }
}
